package config;

import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

@Component
@EnableConfigurationProperties(OssProperties.class)
public class OssConfig {


    @Autowired
    OssProperties ossProperties;

    @Bean
    public OSS ossClient(){
        OSS oss = new OSSClient(ossProperties.getEndpoint(),ossProperties.getAsscesskey(),ossProperties.getAsscessKeysecret());
        return oss;
    }

}
